<?php

namespace App\Models\Api;

use Illuminate\Database\Eloquent\Model;

/**
 * \App\Models\Api\Chat
 *
 * @property int $id
 * @property int $uid 用户id
 * @property int $fid 好友id
 * @property string|null $message 聊天信息
 * @property \Illuminate\Support\Carbon $created_at
 * @property \Illuminate\Support\Carbon $updated_at
 * @method static \Illuminate\Database\Eloquent\Builder|Chat newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|Chat newQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|Chat query()
 * @method static \Illuminate\Database\Eloquent\Builder|Chat whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Chat whereFid($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Chat whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Chat whereMessage($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Chat whereUid($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Chat whereUpdatedAt($value)
 * @mixin \Eloquent
 */
class Chat extends Model
{
    protected $fillable = ['uid', 'fid', 'message'];

    public function insert($uid, $fid, $message)
    {
        return self::create([
            'uid' => $uid,
            'fid' => $fid,
            'message' => $message,
        ]);
    }
}
